<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>location对象</title>
	</head>
	<body>
		<button type="button" onclick="test()">跳转</button>
		<button type="button" onclick="test1()">replace</button>
	</body>
	<script type="text/javascript">
		//获取当前访问的url
		var url=window.location.href;
		console.log(url);
		function test(){
			//设置url页面跳转
			//window.location.href=""
			window.location.href="http://www.baidu.com";
		}
		
		function test1(){
			//设置url页面跳转
			//window.location.href=""
			window.location.replace("http://www.baidu.com");
		}
		
	</script>
</html>
